<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>风险提示证券</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">									
			.fixedBox{
				border: 1px solid #555555;				
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 10px;     
				height: 10px;				
			}
						
		</style>
	</head>
	<body>							
		<div id="towrite" class="fixedBox"></div>			
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>		
		<script>
			var bkcolor = $("body").css("backgroundColor")					
			window.onload = function() {								
				getSource(1);			
				changeStyle();					
			}
			
			function changeStyle() {
				var obj = document.getElementById("towrite");				
				obj.style.left= "0px"; 				
				obj.style.width= "98%";	
				obj.style.height= "620px";		
				obj.style.fontSize="14px";			
			}								
			
			function getSource(p) {
				var div = document.getElementById('towrite');				
				var p1 = "<a href='javascript:void(0)' id='px1' onclick='getSource(1)'>" + "重点监控证券" + "</a>";	
				var p2 = "<a href='javascript:void(0)' id='px2' onclick='getSource(2)'>" + "风险证券类别" + "</a>";	
				var p3 = "<a href='javascript:void(0)' id='px3' onclick='getSource(3)'>" + "风险警示股票" + "</a>";
				var p4 = "<a href='javascript:void(0)' id='px4' onclick='getSource(4)'>" + "退市整理股票" + "</a>";
				var p5 = "<a href='javascript:void(0)' id='px5' onclick='getSource(5)'>" + "严重异常波动证券" + "</a>";														
				div.innerHTML = '<p><font size="4">风险提示</font><font size="2">（ ' + p1 + p5 + '）</font></p>';						
				aObj = document.getElementById('px' + p);				
				aObj.style.color = "#FFA07A";
				
				var data1 = "queryType=1&stockKeyWord=&marketType=&pageNo=1&pageSize=10";
				var data2 = "queryType=2&marketType=&stockType=&pageNo=1&pageSize=10";
				var data3 = "exType=&pageNo=1&pageSize=10";
				var data4 = "exType=&pageNo=1&pageSize=10";
				var data5 = "exType=&sname=&pageNo=1&pageSize=10";
				
				var url1 = "https://stock.hnchasing.com/cxgw/riskstock/list"
				var url2 = "https://stock.hnchasing.com/cxgw/riskstock/list"
				var url3 = "https://stock.hnchasing.com/cxgw/riskstock/listRiskWarnList"
				var url4 = "https://stock.hnchasing.com/cxgw/riskstock/listOutMarketList"
				var url5 = "https://stock.hnchasing.com/cxgw/riskstock/listQuiverGroupList"
				var url = "";
				var data = "";
				if(p == 1){
					url = url1;
					data = data1;
				}else if(p == 2){
					url = url2;
					data = data2;
				}else if(p == 3){
					url = url3;
					data = data3;
				}else if(p == 4){
					url = url4;
					data = data4;
				}else if(p == 5){
					url = url5;
					data = data5;
				}
				var res = [];
				$.ajax({
					type: "post",
					url: url,						
					data : data,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {					
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));	
						res = data.data.datas;
					}
				});	
				//document.write(JSON.stringify(res));	
				
				if(res.length > 0){
					for (var i = 0; i < res.length; i++){													
							var code = res[i].stockCode;
							var st = "";
							if(p == 1){
								st = res[i].startDate;
							}else if(p == 5){
								st = res[i].beginDate;
							}
							
							var gg = "<a style='color:#F9F9F9;' href='http://www.treeid/code_" + code + 
								"' onclick='changeCss(this);'>" + code + 
								"&nbsp;&nbsp;" + res[i].stockName + "&nbsp;&nbsp;开始日期：" + 
								st + "&nbsp;&nbsp;结束日期：" + res[i].endDate + "</a>";
							var jx = "<td><a href='javascript:void(0)' id='xq' onclick='update(" + "\"" + code + "\"" + ");' style='position:absolute;left:450px;color:#FFA07A'>" + "详情" + "</a></td>";														
							div.innerHTML += "<p style='margin-bottom:5px;'>" + gg + jx + "</p>";
							//div.innerHTML += "<p>" + gg + jx + "</p>";
							
							var xq = "";
							if(p == 1){
								xq = res[i].noticeInfo;
							}else if(p == 5){
								xq = res[i].exeRemark;
							}
							//添加分类Div
							var newDiv = document.createElement("div");
							newDiv.id = code;							
							newDiv.style.display = "none";
							newDiv.style.width = "95%";
							newDiv.style.marginLeft = "-5px";
							newDiv.style.border = "1px solid #646464";
							newDiv.style.color = "#FFFACD";
							newDiv.style.whiteSpace = "normal";
							//newDiv.style.fontSize= "14px";	
							//temp += code + ";";							
							div.appendChild(newDiv);
							newDiv.innerHTML += xq;
					}							
				}
			}
			
			var temp = "";	
			function update(ss) {	
				div = document.getElementById(ss);
				if(temp.indexOf(ss) == -1){
					temp += ss + ";";
					div.style.display = "block";
				}else{
					temp = temp.replace(ss + ";" , "");
					div.style.display = "none";
				}
			}
			
			function changeCss(obj){				
				var alist = document.getElementById("towrite").getElementsByTagName("a");					
				for(var i = 0; i < alist.length; i++){				
					if(alist[i].id != "xq" && alist[i].id.indexOf("px") == -1){
						alist[i].style.color = "#F9F9F9"; //给所有a标签赋原色
					}
				}
				obj.style.color = "#00FFFF"; //令当前标签高亮				
			}
			
		</script>						
	</body>
</html>